package com.example.spring.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.spring.demo.entity.SysMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysMenuMapper extends BaseMapper<SysMenu> {
    //根据用户id查询菜单
    @Select("""
select m.* from user_menu as um 
left join sys_menu as m on um.menu_id = m.menu_id
where um.user_id =#{userId}
""")
    List<SysMenu> getMenuByUserId(@Param("userId") Long userId);
}
